package com.gxa.setting.controller;

import com.gxa.common.base.RespResult;
import com.gxa.setting.dto.AddLabelsDto;
import com.gxa.setting.dto.UpdateLabelsDto;
import com.gxa.setting.service.SetLabelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(("/setLabel"))
public class SetLabelController {

    @Autowired
    private SetLabelService setLabelService;

    /**
     * 分页查询服务列表
     * @param currentPage
     * @param pageSize
     * @return
     */
    @GetMapping("/serviceList")
    @ResponseBody
    public RespResult serviceList(Integer currentPage,Integer pageSize){

        return setLabelService.serviceList(currentPage,pageSize);
    }

    /**
     * 根据服务id添加标签
     * @return
     */
    @PostMapping("/addLabelsByServiceId")
    @ResponseBody
    public RespResult addLabelsByServiceId(@RequestBody AddLabelsDto addLabelsDto){

        return setLabelService.addLabelsByServiceId(addLabelsDto);
    }

    /**
     * 根据服务id、标签id修改标签名
     * @return
     */
    @PostMapping("/updateLabelSByServiceIdAndLabelIds")
    @ResponseBody
    public RespResult updateLabelSByServiceIdAndLabelIds(UpdateLabelsDto updateLabelsDto){

        return setLabelService.updateLabelSByServiceIdAndLabelIds(updateLabelsDto);
    }

    /**
     * 根据服务id，查询标签列表
     * @param serviceId
     * @return
     */
    @GetMapping("/queryLabelListByServiceId")
    @ResponseBody
    public RespResult queryLabelListByServiceId(Integer serviceId){

        return setLabelService.queryLabelListByServiceId(serviceId);
    }

    /**
     * 根据标签id修改状态
     * @param id
     * @return
     */
    @GetMapping("/updateLabelById")
    @ResponseBody
    public RespResult updateLabelById(Integer id){

        return setLabelService.updateLabelById(id);
    }

}
